package com.nageoffer.jobtrain.admin.common.config;

import com.nageoffer.jobtrain.admin.common.biz.user.UserTransmitFilter;
import org.junit.jupiter.api.Order;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 管理员用户过滤链配置类
 * author：唐晨
 */
@Configuration
public class UserConfiguration {
    /**
     * 用户信息传递过滤器配置
     */
    @Bean
    @Order(1)
    public FilterRegistrationBean<UserTransmitFilter> globalUserTransmitFilter() {
        FilterRegistrationBean<UserTransmitFilter> registration = new FilterRegistrationBean<>();
        registration.setFilter(new UserTransmitFilter());
        registration.addUrlPatterns("/*");
        // 设置过滤器的优先级
        registration.setOrder(1);
        return registration;
    }
}
